<template>
    <el-date-picker
            v-model="model"
            :type="type"
            @change="changed()"
            :placeholder="placeholder"
             size="small"
            :disabled="disabled"
    ></el-date-picker>
</template>
<script>
    export default {
        name: 'SJtime', 
        props: ['value', 'type', 'placeholder', 'disabled'],  //type: date, dateTime
        data() {
            return {
                input: '',
                model: this.value, 
            }
        },
        created() {
            this.model = this.value
        },
        methods: {
            changed() {
                if (this.type =='datetime' ) {
                   this.input = new Date(this.model).getTime()  
                    this.$emit('change', this.input)
                    this.$emit('input', this.input)
                }
            },
        },
        watch: {
            value: function () {
                this.model = this.value
            }
        }
    }
</script>